Skip to content

Add pinctrl_bcm2835_rust.rs#1

Open
shtiy2023 wants to merge 2 commits intoBUPT-OS:rustfrom
shtiy2023:bcm2835_qemu_test
Open

Add pinctrl_bcm2835_rust.rs#1
shtiy2023 wants to merge 2 commits intoBUPT-OS:rustfrom
shtiy2023:bcm2835_qemu_test

Conversation

@shtiy2023
Copy link
Copy Markdown

@shtiy2023 shtiy2023 commented Apr 22, 2024

Rewrite GPIO registration part in pinctrl-bcm2835.c using Rust.
pinctrl_bcm2835_rust.rs has been tested on the virt machine in QEMU, and libgpiod can successfully call the GPIO controller through the `pinctrl_bcm2835_rust'.

Issue:

bcm2835_rust fails to register on Raspberry Pi 4B, and the error displayed in syslog is:
pinctrl_bcm2835_rust: probe of fe200000.gpio failed with error -22
And KGDB and jlink cannot be used to debug this driver since both kgdb and jlink are based on the gpio driver on the board.

Changes needed:

  • Investigate the reason behind the failure to register bcm2835_rust on Raspberry Pi 4B.

Copy link
Copy Markdown

@Richardhongyu Richardhongyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! You can add more details about how to evaluate this driver and what you can do with this. Besides, you can add some links of the prior mails when we had touch out with the community.

Comment on lines +17 to +39
macro_rules! FSEL_REG {
($p:expr) => {
GPFSEL0 + (($p / 10) * 4)
};
}

macro_rules! FSEL_SHIFT {
($p:expr) => {
(($p % 10) * 3)
};
}

macro_rules! GPIO_REG_OFFSET {
($p:expr) => {
$p / 32
};
}

macro_rules! GPIO_REG_SHIFT {
($p:expr) => {
$p % 32
};
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not move these to macro.rs of RFL of gpio related files?

@shtiy2023 shtiy2023 closed this Apr 22, 2024
@shtiy2023 shtiy2023 reopened this Apr 22, 2024
Copy link
Copy Markdown

@ruiqurm ruiqurm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGFM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants